class Solution
{
public:
    int maxNiceDivisors(int primeFactors)
    {
        if (primeFactors <= 4)
        {
            return primeFactors;
        }
        long long threeCount = primeFactors / 3;
        long long twoCount = 0;
        if (primeFactors % 3 == 1)
        {
            --threeCount;
            twoCount = 2;
        }
        else if (primeFactors % 3 == 2)
        {
            twoCount = 1;
        }

        auto fastPow = [](long long base, long long exp)
        {
            long long result = 1;
            while (exp)
            {
                if (exp & 1)
                {
                    result *= base;
                    result %= 1'0000'0000'7;
                }
                base *= base;
                base %= 1'0000'0000'7;
                exp = exp >> 1;
            }
            return result;
        };
        long long result = fastPow(2, twoCount) * fastPow(3, threeCount);
        result %= 1'0000'0000'7;
        return result;
    }
};